package com.karaoke.android.data.utils

import android.content.Context
import android.content.Intent
import android.provider.Settings
import com.apkfuns.logutils.LogUtils

/**
 * Created by Administrator on 2017/4/11.
 */

/**
 * 獲取設備序列號
 */
fun getDeviceSN(): String
{
    var serial: String = ""
    try
    {
        val c = Class.forName("android.os.SystemProperties")
        val get = c.getMethod("get", String::class.java)
        serial = get.invoke(c, "ro.boot.serialno") as String
        val s = System.getProperty("ro.boot.serialno") as String?
        LogUtils.e("$serial $s")
    }
    catch (e: Exception)
    {
        e.printStackTrace()
    }
    return serial
}

//val objectMapper by lazy {
//    ObjectMapper().apply {
//        setSerializationInclusion(JsonInclude.Include.NON_NULL)
//        configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
//        disable(SerializationFeature.FAIL_ON_EMPTY_BEANS)
//    }
//}

fun Context.hideSystemBar(hide: Boolean)
{
    Settings.System.putInt(contentResolver, "systembar_hide", if (hide) 1 else 0)
    val i = Intent("com.tchip.changeBarHideStatus")
    sendBroadcast(i)
}